﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.IO;

namespace mesoBoard.Common.UrlHelpers
{
    public static class UrlHelpers
    {

        public static string ThemeImage(this UrlHelper url, string ImageFileName)
        {
            string themeName = url.RequestContext.HttpContext.Items["mbThemeFolder"].ToString();

            return url.Content("~/Themes/" + themeName + "/Images/" + ImageFileName);
        }

        public static string ThemeContent(this UrlHelper url, string themeFolderRelativeURL)
        {
            string themeName = url.RequestContext.HttpContext.Items["mbThemeFolder"].ToString();

            themeFolderRelativeURL = themeFolderRelativeURL.Replace("~/", "");

            return url.Content("~/Themes/" + themeName + "/" + themeFolderRelativeURL);
        }

        public static string ParseThemeUrl(this UrlHelper url, string themefolderRelativeUrl)
        {
            string themeName = url.RequestContext.HttpContext.Items["mbThemeFolder"].ToString();

            return themefolderRelativeUrl.Replace("{CTF}", "~/Themes/"+themeName);
        }

    }
}
